import { ref, Ref, onMounted, onUnmounted } from "vue";
const useIsMouseOver = (elementRef: Ref<null | HTMLElement>) => {
    let isOver = ref(false);
    const handler = (boolValue: boolean) => {
        isOver.value = boolValue;
    }
    onMounted(() => {
        if (elementRef.value) {
            elementRef.value.addEventListener("mouseover", () => handler(true));
            elementRef.value.addEventListener("mouseout", () => handler(false));
        }
    })
    onUnmounted(() => {
        if (elementRef.value) {
            elementRef.value.removeEventListener("mouseover", () => handler(true));
            elementRef.value.removeEventListener("mouseout", () => handler(false));
        }
    })
    return isOver;
}
export default useIsMouseOver;